package com.sd.repay.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 项目启动监听器
 */
public class CtxListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {

        System.out.println("=================代还系统已启动=================");
        ServletContext sc = sce.getServletContext();
        String ctx = sc.getContextPath();
        System.out.println("项目根目录" + ctx);
        sc.setAttribute("ctx", ctx);

    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("web容器关闭");
    }
}
